//
//  TGAdvertTableViewCell.m
//  WanCaiC8
//
//  Created by QiuXun on 2019/1/22.
//  Copyright © 2019 tangang. All rights reserved.
//

#import "TGAdvertTableViewCell.h"
@interface TGAdvertTableViewCell()
@property(nonatomic,strong)AdvertisingView *advertisingView;

@end
@implementation TGAdvertTableViewCell{
    QXLable *labTitle;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
    
        [self setupUI];
    }
    return self;
}

-(void)setupUI{

    WS(weakSelf);
    self.advertisingView  = [[AdvertisingView alloc]init];
    self.advertisingView.changeHeight = ^(float height) {
        [weakSelf.advertisingView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(@(height));
        }];
    };
    [self.contentView addSubview:self.advertisingView];
    [self.advertisingView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.contentView).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.top.equalTo(weakSelf.contentView).offset(5);
        make.bottom.equalTo(weakSelf.contentView).offset(-5);
        make.height.mas_equalTo(@0);
    }];
}



-(void)setAdModelArr:(NSMutableArray *)adModelArr AndRowCount:(NSInteger)rowCount{
    
    
    if (adModelArr.count>0) {
        self.advertisingView.dataArr = adModelArr;
        self.advertisingView.changeHeight(rowCount*40);
    }else{
        
        self.advertisingView.changeHeight(0);

    }
}



@end
